package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenTransportSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerTransportAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.transport.Transport;
import com.wlyuan.open.scanner.repository.TransportRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.TRANSPORT)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerTransportHandler extends BaseScannerHandler<Transport, OpenTransportSyncDTO> {
    private final TransportRepository transportRepository;

    @Override
    protected List<Transport> select() {
        return transportRepository.transportList();
    }

    @Override
    protected List<OpenTransportSyncDTO> assembler(List<Transport> data) {
        return ScannerTransportAssembler.assemble(data);
    }
}
